package tt.dz.egobus.servicemanager.service;

import tt.dz.egobus.api.usercenter.user.UserInfoBack;
import tt.dz.egobus.servicemanager.base.service.ExtendBaseService;
import tt.dz.egobus.servicemanager.entities.BusinessExceptionAlert;
import tt.dz.egobus.servicemanager.entities.DriverRegisterBusRelative;
import tt.dz.egobus.servicemanager.vo.BusinessFinishVo;

import java.util.List;

/**
 * @author Anson
 * @date 17-3-21
 * @name 司机绑定车
 * @since 1.0.2
 */
public interface DriverRegisterBusRelativeService extends ExtendBaseService<DriverRegisterBusRelative, String> {

    /**
     * @param busId      车辆id
     * @param driverInfo 司机详细信息
     * @author Anson
     * @date 17-3-21
     * @name 激活流程
     * @since 1.0.2
     */
    boolean active(String busId, UserInfoBack driverInfo);

    /**
     * @param busId
     * @param driverId
     * @return true :存在绑定，false不存在绑定
     * @author Anson
     * @date 17-3-23
     * @name 是否当前司机与车存在绑定关系
     * @since 1.0.2
     */
    boolean isBindDriverAndCar(String busId, String driverId);

    /**
     * @param busId
     * @author Anson
     * @date 17-3-23
     * @name 是否车存在有效绑定关系
     * @since 1.0.2
     */
    boolean isValidateBindCar(String busId);

    /**
     * @param driverId
     * @author Anson
     * @date 17-3-23
     * @name 是否司机存在有效绑定关系
     * @since 1.0.2
     */
    boolean isValidateBindDriver(String driverId);

    /**
     * @param relative 当前司机的
     * @return 当前是否下线成功
     * @author Anson
     * @date 17-3-21
     * @name 司机下线 是否成功
     * @since 1.0.2
     */
    boolean down(DriverRegisterBusRelative relative);

    /**
     * @param driverId 司机id
     * @author Anson
     * @date 17-3-23
     * @name 查询司机当前有效绑定的信息
     * @since 1.0.2
     */
    List<DriverRegisterBusRelative> queryValidateCarDriverBind(String driverId);


    /**
     * @param relative
     * @param businessId
     * @author Anson
     * @date 17-3-28
     * @name 司机开始派单信息 ，即 推送单子-> driver
     * @since 1.0.3
     */
    boolean doUpdateBeginBusiness(DriverRegisterBusRelative relative, String businessId);

    /**
     * @param driverId 获取当前绑定的司机的车所注册的服务
     * @author Anson
     * @date 17-3-28
     * @name
     * @since 1.0.3
     */
    int[] getBusBusinessCodes(String driverId);

    /**
     * @param relativeId 关系id
     * @author Anson
     * @date 17-3-28
     * @name 更新当前关系状态
     * @since 1.0.3
     */
    boolean doBusiness(String relativeId);

    /**
     * @param relative 关系
     * @param vo       业务完成vo
     * @author Anson
     * @date 17-3-29
     * @name 完成业务逻辑
     * @since 1.0.3
     */
    boolean doFinish(DriverRegisterBusRelative relative, BusinessFinishVo vo);

    /**
     * @param serviceRegister 绑定id
     * @author Anson
     * @date 17-4-1
     * @name 用户取消
     * @since 1.0.3
     */
    boolean doUserCancel(DriverRegisterBusRelative serviceRegister);

    /**
     * @param relative
     * @param alert
     * @author Anson
     * @date 17-3-30
     * @name 当前状态设为异常，并且解除当前有效绑定关系
     * @since 1.0.3
     */
    boolean doSaveException(DriverRegisterBusRelative relative, BusinessExceptionAlert alert);

    /**
     * @param busId 车辆信息
     * @author Anson
     * @date 17-5-22
     * @name 删除车辆绑定关系
     * @since 1.0.4
     */
    int deleteDriverRelativeByBusId(String busId);

    /**
     * @param busId            当前车辆信息
     * @param isFilterValidate 是否需要过滤有效的关系
     * @author Anson
     * @date 17-5-22
     * @name 当前车辆是否存在司机关系
     * @since 1.0.4
     */
    void validateDriverelative(String busId, boolean isFilterValidate);

}
